package nccloud.web.hrpbm.budgetswap.budgetswapvo.action;

import java.util.HashMap;
//import java.util.List;
import java.util.Map;
//import nccloud.framework.web.ui.pattern.grid.Grid;
import nccloud.web.codeplatform.framework.action.base.BaseAction;
import nccloud.web.codeplatform.framework.action.base.RequstParamWapper;
import nccloud.web.codeplatform.framework.action.base.RequestDTO;
import nccloud.web.codeplatform.framework.action.base.VOTransform;
import nccloud.framework.service.ServiceLocator;
import nccloud.framework.core.util.ArrayUtils;
import nccloud.framework.web.container.IRequest;
import nc.itf.hrpbm.budgetswap.budgetswapvo.IBudgetswapVOService;
import nc.vo.hrpbm.budgetswap.AggBudgetswapVO;
import nccloud.web.hrpbm.HrpbmHandlerUtil;

/**
 * 保存action（主子、单表、单form）
 */
public class SaveBudgetswapVOAction extends BaseAction{

    @Override
    public Object doAction(IRequest request, RequstParamWapper paramWapper) throws Throwable{
        RequestDTO param = VOTransform.toVO(paramWapper.requestString,RequestDTO.class);

        IBudgetswapVOService service = ServiceLocator.find(IBudgetswapVOService.class);

        AggBudgetswapVO[] vos = this.getVOs(param, AggBudgetswapVO.class);
        // modify by wy at 检查 是否存在预算调剂 转出科室存在转给自己及其他科室的情况
        HrpbmHandlerUtil.checkBudgetsWapIsRepeat(vos);
        vos = service.saveAggBudgetswapVO(vos[0] );
        Object result = buildResult(param,param.getBillCard().getHead()!=null,null,vos);
        return result;
    }

}
